From 16a0782cea268a585d7f3b1d0f7536a8c514f8e2 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 31 Jan 2004 22:11:07 +0000 Subject: [PATCH] Don't crash when finalizing an unused GtkTextChildAnchor. (#132260, Sat Jan 31 23:13:43 2004 Matthias Clasen * gtk/gtktextchild.c (gtk_text_child_anchor_finalize): Don't crash when finalizing an unused GtkTextChildAnchor. (#132260, muppet) --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtktextchild.c | 31 +++++++++++++++++-------------- 6 files changed, 47 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65e754e6f3..878e8e02a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Jan 31 23:13:43 2004 Matthias Clasen + + * gtk/gtktextchild.c (gtk_text_child_anchor_finalize): Don't + crash when finalizing an unused GtkTextChildAnchor. (#132260, + muppet) + Sat Jan 31 22:41:57 2004 Matthias Clasen * gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Correct diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 65e754e6f3..878e8e02a1 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Sat Jan 31 23:13:43 2004 Matthias Clasen + + * gtk/gtktextchild.c (gtk_text_child_anchor_finalize): Don't + crash when finalizing an unused GtkTextChildAnchor. (#132260, + muppet) + Sat Jan 31 22:41:57 2004 Matthias Clasen * gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Correct diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 65e754e6f3..878e8e02a1 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Sat Jan 31 23:13:43 2004 Matthias Clasen + + * gtk/gtktextchild.c (gtk_text_child_anchor_finalize): Don't + crash when finalizing an unused GtkTextChildAnchor. (#132260, + muppet) + Sat Jan 31 22:41:57 2004 Matthias Clasen * gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Correct diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 65e754e6f3..878e8e02a1 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Sat Jan 31 23:13:43 2004 Matthias Clasen + + * gtk/gtktextchild.c (gtk_text_child_anchor_finalize): Don't + crash when finalizing an unused GtkTextChildAnchor. (#132260, + muppet) + Sat Jan 31 22:41:57 2004 Matthias Clasen * gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Correct diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 65e754e6f3..878e8e02a1 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Sat Jan 31 23:13:43 2004 Matthias Clasen + + * gtk/gtktextchild.c (gtk_text_child_anchor_finalize): Don't + crash when finalizing an unused GtkTextChildAnchor. (#132260, + muppet) + Sat Jan 31 22:41:57 2004 Matthias Clasen * gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Correct diff --git a/gtk/gtktextchild.c b/gtk/gtktextchild.c index 0cc68f347f..a92944e3d5 100644 --- a/gtk/gtktextchild.c +++ b/gtk/gtktextchild.c @@ -377,24 +377,27 @@ gtk_text_child_anchor_finalize (GObject *obj) seg = anchor->segment; - if (seg->body.child.tree != NULL) + if (seg) { - g_warning ("Someone removed a reference to a GtkTextChildAnchor " - "they didn't own; the anchor is still in the text buffer " - "and the refcount is 0."); - return; - } + if (seg->body.child.tree != NULL) + { + g_warning ("Someone removed a reference to a GtkTextChildAnchor " + "they didn't own; the anchor is still in the text buffer " + "and the refcount is 0."); + return; + } - tmp_list = seg->body.child.widgets; - while (tmp_list) - { - g_object_unref (tmp_list->data); - tmp_list = g_slist_next (tmp_list); - } + tmp_list = seg->body.child.widgets; + while (tmp_list) + { + g_object_unref (tmp_list->data); + tmp_list = g_slist_next (tmp_list); + } - g_slist_free (seg->body.child.widgets); + g_slist_free (seg->body.child.widgets); - g_free (seg); + g_free (seg); + } anchor->segment = NULL; } -- 2.30.2